package com.xuecheng.learning.application.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xuecheng.base.exception.XueChengPlusException;
import com.xuecheng.learning.application.service.XcLearnApplication;
import com.xuecheng.learning.domain.model.entity.XcCourseTables;
import com.xuecheng.learning.domain.model.enums.XcTablesEnum;
import com.xuecheng.learning.domain.model.vo.resp.XcChooseCourseResp;
import com.xuecheng.learning.domain.model.vo.resp.XcTablesResp;
import com.xuecheng.learning.domain.service.XcChooseCourseService;
import com.xuecheng.learning.domain.service.XcCourseTablesService;
import com.xuecheng.learning.domain.service.XcLearnRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-09-12  22:55
 */
@Service
public class XcLearnApplicationImpl implements XcLearnApplication {

    @Autowired
    private XcChooseCourseService xcChooseCourseService;

    @Autowired
    private XcLearnRecordService xcLearnRecordService;

    @Override
    public XcTablesResp getLearnStatus(Long userId, Long courseId) {
        return new XcTablesResp(xcLearnRecordService.getLearnStatus(userId, courseId));
    }

    @Override
    public XcChooseCourseResp chooseCourse(Long userId, Long courseId) {
        if (Objects.isNull(userId) || Objects.isNull(courseId)){
            throw new XueChengPlusException("参数不能为空");
        }

        return xcChooseCourseService.chooseCourse(userId, courseId);
    }
}
